//后台操作COOKIE
function setCookie1(key,value,time1=0){
    if(time1){
        var t1 = new Date()-8*3600-1000+time1*1000;
        var tt = new Date(t1);
        document.cookie = `${key}=${value};expires=${tt}`
    }else{
        document.cookie = `${key}=${value}`
    }
}

//获得指定的cookie
function getCookie1(key){
    //获取所有的cookie
    var str1 = document.cookie;
    //分割当前字符串
    var ar1=str1.split(';')
    //遍历数组每一个元素
    for(var i=0;i<ar1.length;i++){
        var ar2 = ar1[i].split('=');
        //判断当前数组的第一个元素是否等于传入key
        if(ar2[0]==key){
            return ar2[1];
        }
    }
}

//删除指定cookie
function delCookie1(key,t1=-1){
    setCookie1(key,'',t1)
}